/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PEditRegion.java
 *
 * Created on Mar 28, 2012, 5:25:09 PM
 */
package com.bc5Neptune.cis.gui;
import static com.bc5Neptune.cis.bll.GlobalObject.*;
import com.bc5Neptune.cis.bll.IconList;
import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 *
 * @author phu.huynh
 */
public class PEditRegion extends javax.swing.JPanel {

    /** Creates new form PEditRegion */
    public PEditRegion() {
        initComponents();
        /* set transperance for those components */
        this.setOpaque(false);
        this.setBackground(new Color(1, 1, 1, 0.1f));
        pnlEditRegion.setOpaque(false);
        //getContentPane().setBackground(new Color(1, 1, 1, 0.4f));
        // pnlEditRegion.setOpaque(false);
        pnlEditRegion.setBackground(new Color(1, 1, 1, 0.1f)); //red, blue, green
        pnlFace.setOpaque(false);
        pnlFace.setBackground(new Color(1, 1, 1, 0.1f));

        /* event update name of face after for new change */
        tblEditRegion.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                //super.keyReleased(e);
                String str = (String) tblEditRegion.getValueAt(0, 0);
                System.out.println(".....value of table .." + str);
                IconList objSmall = (IconList)GLPDetect.lstFaceImages.getSelectedValue();
                objSmall.setName(str);
            }
        });
        /* show draw panel image*/
        //pnlShowImage.setLayout(new BoxLayout(pnlShowImage, BoxLayout.PAGE_AXIS));
        //pnlShowImage.add(new PDrawPanel());
        //tblEditRegion.set
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlEditRegion = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tblEditRegion = new javax.swing.JTable();
        jSeparator3 = new javax.swing.JSeparator();
        jSeparator4 = new javax.swing.JSeparator();
        pnlFace = new javax.swing.JPanel();
        lblFace = new javax.swing.JLabel();

        pnlEditRegion.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        tblEditRegion.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"unknow"}
            },
            new String [] {
                "Name"
            }
        ));
        tblEditRegion.setInheritsPopupMenu(true);
        tblEditRegion.setName(""); // NOI18N
        jScrollPane8.setViewportView(tblEditRegion);

        pnlEditRegion.add(jScrollPane8, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 280, 60));

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator3.setAlignmentX(0.0F);
        jSeparator3.setAlignmentY(0.0F);
        jSeparator3.setBorder(null);
        pnlEditRegion.add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 0, 10, 140));

        jSeparator4.setBorder(null);
        pnlEditRegion.add(jSeparator4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 140, 400, 20));

        pnlFace.setBorder(javax.swing.BorderFactory.createTitledBorder("Face"));
        pnlFace.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        pnlFace.add(lblFace, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 92, 112));

        pnlEditRegion.add(pnlFace, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 110, 140));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlEditRegion, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlEditRegion, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    public javax.swing.JLabel lblFace;
    private javax.swing.JPanel pnlEditRegion;
    private javax.swing.JPanel pnlFace;
    public javax.swing.JTable tblEditRegion;
    // End of variables declaration//GEN-END:variables
}
